﻿/*
Copyright (c) 2012 Maksim Gordeev

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

*/


/*
 * Сделано в SharpDevelop.
 * Пользователь: maxxadm
 * Дата: 26.06.2012
 * Время: 15:57
 * 
 * Для изменения этого шаблона используйте Сервис | Настройка | Кодирование | Правка стандартных заголовков.
 */
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace jellybird.core
{
	/// <summary>
	/// Object returns from account/settings.json
	/// </summary>
	public class TwAccountSettings
	{
		/*
		 * https://dev.twitter.com/docs/api/1/get/account/settings
		 * https://dev.twitter.com/docs/api/1/post/account/settings
		 * 
		 * На самом деле из settings.json возвращается
		 * {"protected":false,
		 * "discoverable_by_email":true,
		 * "geo_enabled":true,
		 * "trend_location":
		 * 		[{"name":"\u0420\u043e\u0441\u0441\u0438\u044f",
		 * 		"placeType":{"name":"Country","code":12},
		 *		"parentid":1,
		 *		"url":"http:\/\/where.yahooapis.com\/v1\/place\/23424936",
		 * 		"countryCode":"RU",
		 * 		"country":"Russia",
		 * 		"woeid":23424936}],
		 * "sleep_time":{"enabled":true,"start_time":2,"end_time":8},
		 * "show_all_inline_media":true,
		 * "time_zone":{"name":"Moscow","utc_offset":14400,"tzinfo_name":"Europe\/Moscow"},
		 * "use_cookie_personalization":true,
		 * "always_use_https":true,
		 * "screen_name":"maxnetish",
		 * "language":"ru"}
		 * 
		 * неупомянутые поля дублируются в TwUser
		 */
		
		public TwAccountSettings()
		{
		}
		
		TwSleepTime sleepTime;
		
		[JsonProperty(Constants.SLEEP_TIME)]
		public TwSleepTime SleepTime {
			get { return sleepTime; }
			set { sleepTime = value; }
		}
		
		List<TwTrendLocation> trendLocations;
		
		[JsonProperty(Constants.TREND_LOCATION)]
		public List<TwTrendLocation> TrendLocations {
			get { return trendLocations; }
			set { trendLocations = value; }
		}
		
		string language;
		
		[JsonProperty(Constants.LANGUAGE)]
		public string Language {
			get { return language; }
			set { language = value; }
		}
		
		bool alwaysUseHttps;
		
		[JsonProperty(Constants.ALWAYS_USE_HTTPS)]
		public bool AlwaysUseHttps {
			get { return alwaysUseHttps; }
			set { alwaysUseHttps = value; }
		}
		
		
		bool discoverableByEmail;
		
		[JsonProperty(Constants.DISCOVERABLE_BY_EMAIL)]
		public bool DiscoverableByEmail {
			get { return discoverableByEmail; }
			set { discoverableByEmail = value; }
		}
		
		TwTimeZone timeZone;
		
		[JsonProperty(Constants.TIME_ZONE)]
		public TwTimeZone TimeZone {
			get { return timeZone; }
			set { timeZone = value; }
		}
		
		bool enableGeo;
		
		[JsonProperty(Constants.GEO_ENABLED)]
		public bool EnableGeo {
			get { return enableGeo; }
			set { enableGeo = value; }
		}
		
		#region sleep time
		public class TwSleepTime
		{
			public TwSleepTime()
			{
			}
			
			string endTime;
			
			[JsonProperty(Constants.END_TIME)]
			public string EndTime {
				get { return endTime; }
				set { endTime = value; }
			}
			
			bool enabled;
			
			[JsonProperty(Constants.ENABLED)]
			public bool Enabled {
				get { return enabled; }
				set { enabled = value; }
			}
			
			string startTime;
			
			[JsonProperty(Constants.START_TIME)]
			public string StartTime {
				get { return startTime; }
				set { startTime = value; }
			}
		}
		#endregion
		
		#region trend location
		/*
		"name": "Worldwide",
        "woeid": 1,
      
        "placeType": {
        "name": "Supername",
        "code": 19
        },
      
        "country": "",
        "url": "http://where.yahooapis.com/v1/place/1",
        "countryCode": null
		 */
		public class TwTrendLocation
		{
			public TwTrendLocation()
			{
			}
			
			string locationName;
			
			[JsonProperty(Constants.NAME)]
			public string LocationName {
				get { return locationName; }
				set { locationName = value; }
			}
			
			int woeId;
			
			[JsonProperty(Constants.WOEID)]
			public int WoeId {
				get { return woeId; }
				set { woeId = value; }
			}
			
			TwPlaceType placeType;
			
			[JsonProperty(Constants.PLACE_TYPE)]
			public TwPlaceType PlaceType {
				get { return placeType; }
				set { placeType = value; }
			}
			
			string country;
			
			[JsonProperty(Constants.COUNTRY)]
			public string Country {
				get { return country; }
				set { country = value; }
			}
			
			string url;
			
			[JsonProperty(Constants.URL)]
			public string Url {
				get { return url; }
				set { url = value; }
			}
			
			string countryCode;
			//может это и не string - документация туманна
			[JsonProperty(Constants.COUNTRY_CODE)]
			public string CountryCode {
				get { return countryCode; }
				set { countryCode = value; }
			}
			
			public class TwPlaceType
			{
				string placeTypeName;
				
				[JsonProperty(Constants.NAME)]
				public string PlaceTypeName {
					get { return placeTypeName; }
					set { placeTypeName = value; }
				}
				
				int code;
				
				[JsonProperty(Constants.CODE)]
				public int Code {
					get { return code; }
					set { code = value; }
				}
			}
		}
		#endregion
		
		#region time zone info
		public class TwTimeZone
		{
			string zoneName;
			
			[JsonProperty(Constants.NAME)]
			public string ZoneName {
				get { return zoneName; }
				set { zoneName = value; }
			}
			
			string tzinfoName;
			
			[JsonProperty(Constants.TZINFO_NAME)]
			public string TzinfoName {
				get { return tzinfoName; }
				set { tzinfoName = value; }
			}
			
			int utcOffset;
			
			[JsonProperty(Constants.UTC_OFFSET)]
			public int UtcOffset {
				get { return utcOffset; }
				set { utcOffset = value; }
			}
		}
		#endregion
	}
	
	
}
